﻿using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace WordConversionManager.Layouts.WordConversionManager
{
    public partial class GeneralSettings : LayoutsPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
             SPContext.Current.Web.AllowUnsafeUpdates = true;

             if (!Page.IsPostBack)
             {
                 serviceApplicationNameTextBox.Text = WordConversionManagerSetttings.GetWordServiceApplicationProxy(SPContext.Current.Web);
             }
        }

        protected void SaveSettingsButton_OnClick(object sender, EventArgs e)
        {
            WordConversionManagerSetttings.SetPropertyValue(SPContext.Current.Web, WordConversionManagerSetttings.ServiceApplicationName, serviceApplicationNameTextBox.Text);

            Response.Redirect(string.Format("{0}/_layouts/settings.aspx", SPContext.Current.Web.Url));
        }
    }
}
